package com.zcoj.pojo.Vo;

import com.zcoj.pojo.Dto.Comment;
import com.zcoj.pojo.Dto.Reply;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @author chenbin
 * @version 1.0
 * @description: TODO
 * @date 2023/4/7 14:18
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CommentVO {
 private Integer id;

 private Integer commentId;

 private Integer level ;
 private Integer fromUid;

 private String fromName;
 private String fromRole;
 private String fromAvatar;
 private Integer toUid;
 private String toName;
 private String toAvatar;
 private String content;
 private Date createTime;

 List<CommentVO> replies;
 public void setCommentVoComment(Comment comment){
  this.id=comment.getId();
  this.level=comment.getLevel();
  this.fromName=comment.getFromName();
  this.fromUid=comment.getFromUid();
  this.fromRole=comment.getFromRole();
  this.fromAvatar=comment.getFromAvatar();
  this.content=comment.getContent();
  this.createTime=comment.getCreateTime();
 }
 public void setCommentVoReply(Reply reply){
  this.id=reply.getId();
  this.level=reply.getLevel();
  this.commentId=reply.getCommentId();
  this.content=reply.getContent();
  this.fromUid=reply.getFromUid();
  this.fromName=reply.getFromName();
  this.fromAvatar=reply.getFromAvatar();
  this.fromRole=reply.getFromRole();
  this.toUid=reply.getToUid();
  this.toAvatar=reply.getToAvatar();
  this.toName=reply.getToName();
  this.createTime=reply.getCreateTime();
 }
 public void setCommentVoReplies(List<Reply> replies){
  ArrayList<CommentVO> commentVOS = new ArrayList<>();
  for (Reply reply : replies) {
   CommentVO commentVO = new CommentVO();
   commentVO.setCommentVoReply(reply);
   commentVOS.add(commentVO);
  }
  this.replies=commentVOS;
 }



}
